package com.ffms.servlet;

import com.ffms.dao.impl.ShouruDaoImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/DeleteShouruServlet")
public class DeleteShouruServlet extends HttpServlet {

    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        this.doPost(request, response);
    }
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        //获取要删除的成员姓名
        String id = request.getParameter("id");
        //调用完成删除操作
        ShouruDaoImpl shouruDao = new ShouruDaoImpl();
        try {
            shouruDao.deleteShouruById(id);
            request.getRequestDispatcher("/AllShouruServlet").forward(request, response);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}
